{% extends "base.html" %}
  {% block content %}
        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h2 class="page-header">Minions Key Manage</h2>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Minions Key Manage
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div class="dataTable_wrapper">
                                <form method="post" action="/minions/minions_keys/">
                                <table class="table table-striped table-bordered table-hover" id="datatable-demo">
                                    <thead>
                                        <tr>
                                            <th>Minions</th>
                                            <th>Keys Status</th>
                                            <th>Accept Key</th>
                                            <th>Reject Key</th>
                                            <th>Delete Key</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        {% for hostname in key.minions_pre %}
                                        <tr class="even gradeC">
                                            <td>{{ hostname }}</td>
                                            <td>Unaccepted</td>
                                            <td><button type="submit" class="btn btn-success btn-xs" value="{{ hostname }}" name="accept">Accept Key</button></td>
                                            <td><button type="submit" class="btn btn-warning btn-xs" value="{{ hostname }}" name="reject">Reject Key</button></td>
                                            <td><button type="submit" class="btn btn-danger btn-xs" value="{{ hostname }}" name="delete">Delete Key</button></td>
                                        </tr>
                                        {% endfor %}
                                        {% for hostname in key.minions_denied %}
                                        <tr class="odd gradeA">
                                            <td>{{ hostname }}</td>
                                            <td>Denied</td>
                                            <td><input type="button" class="btn btn-success btn-xs" value="Accept Key"></td>
                                            <td><input type="button" class="btn btn-warning btn-xs" value="Reject Key"></td>
                                            <td><input type="button" class="btn btn-danger btn-xs" value="Delete Key"></td>
                                        </tr>
                                        {% endfor %}
                                        {% for hostname in key.minions_rejected %}
                                        <tr class="even gradeA">
                                            <td>{{ hostname }}</td>
                                            <td>Rejected</td>
                                            <td><button type="submit" class="btn btn-success btn-xs disabled" value="{{ hostname }}" name="accept">Accept Key</button></td>
                                            <td><button type="submit" class="btn btn-warning btn-xs disabled" value="{{ hostname }}" name="reject">Reject Key</button></td>
                                            <td><button type="submit" class="btn btn-danger btn-xs" value="{{ hostname }}" name="delete">Delete Key</button></td>
                                        </tr>
                                        {% endfor %}
                                        {% for hostname in key.minions %}
                                        <tr class="odd gradeX">
                                            <td>{{ hostname }}</td>
                                            <td>Accepted</td>
                                            <td><button type="button" class="btn btn-success btn-xs disabled" value="Accept Key">Accept Key</button></td>
                                            <td><button type="submit" class="btn btn-warning btn-xs disabled" value="{{ hostname }}" name="reject">Reject Key</button></td>
                                            <td><button type="submit" class="btn btn-danger btn-xs" value="{{ hostname }}" name="delete">Delete Key</button></td>
                                        </tr>
                                        {% endfor %}
                                    </tbody>
                                </table>
                                </form>
                            </div>
                            <!-- /.table-responsive -->                  
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
        </div>
        <!-- /#page-wrapper -->
  {% endblock %}

  {% block jquery %}
     <script type="text/javascript">
     $(document).ready(function(){
         //data table
         $("#datatable-demo").DataTable( {
            //设置第一列为初始化排序的列
            "order": [[ 3, "desc" ]],
            });
         // end data table
     });
     </script>
  {% endblock %}

